package com.ctyon.watchmanager.ui.activity;

import android.os.Bundle;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.ctyon.watchmanager.R;
import com.ctyon.watchmanager.ui.BaseActivity;
import com.ctyon.watchmanager.ui.fragment.BusinessFragment;
import com.orhanobut.logger.Logger;

import androidx.fragment.app.FragmentManager;

import static com.ctyon.common.container.ARouterPath.ROUTER_ACTIVITY_BUSINESS;

@Route(path = ROUTER_ACTIVITY_BUSINESS)
public class BusinessActivity extends BaseActivity {

    private FragmentManager fragmentManager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.layout_container);

        fragmentManager = getSupportFragmentManager();

        loadFragment(savedInstanceState);
    }

    private void loadFragment(Bundle savedInstanceState) {
        Logger.i("loadFragment");
        if (savedInstanceState == null) {
            BusinessFragment fragment = BusinessFragment.newInstance();
            fragmentManager
                    .beginTransaction()
                    .add(R.id.fragment_container, fragment, BusinessFragment.TAG)
                    .commit();
        }
    }

}
